﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Revis.VClinicNet.Core.Domain;

using AutoMapper;

namespace Revis.VClinicNet.App.Internal.Dto.Mappers
{
    public class DoctorDtoMapper : IDtoMapper
    {
        public static Func<Doctor, string> Name = (d) => {
            return d.FirstName + " " + d.Surname;
        };        

        public void Map()
        {
            Mapper.CreateMap<Doctor, DoctorDto>();

            Mapper.CreateMap<Doctor, DoctorInfoDto>()
                .ForMember(d => d.Name, mo => mo.MapFrom(d => Name(d)));           

            Mapper.CreateMap<Doctor, DoctorDetailDto>()
                .ForMember(d => d.Doctor, mo => mo.MapFrom( d=> d))
                .ForMember(d => d.WorkingTimes, mo => mo.MapFrom(d => d.WorkSchedule.WorkTimes.Values));
        }
    }
}
